﻿<Window x:Class="ManageCategoriesProducts.EditProductWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:local="clr-namespace:ManageCategoriesProducts"
        Title="Edit product" Height="234" Width="337">
    <Grid>
        <Label Content="Product name:" Height="28" HorizontalAlignment="Left" Margin="12,12,0,0" 
            VerticalAlignment="Top" />
        <Label Content="Description:" Height="28" HorizontalAlignment="Left" Margin="12,38,0,0" 
               VerticalAlignment="Top" />
        <Label Content="Category:" Height="28" HorizontalAlignment="Left" Margin="12,103,0,0" 
               VerticalAlignment="Top" />
        <Label Content="Price:" Height="28" HorizontalAlignment="Left" Margin="12,131,0,0" 
               VerticalAlignment="Top" />
        <TextBox Height="23" HorizontalAlignment="Left" Margin="105,14,0,0" 
                 Name="textBoxProductName" VerticalAlignment="Top" Width="191">
            <Binding Path="ProductName" Mode="TwoWay" UpdateSourceTrigger="PropertyChanged">
                <Binding.ValidationRules>
                    <local:ValidateProductName MinLength="1" MaxLength="20" ErrorMessage=""/>
                </Binding.ValidationRules>
            </Binding>
        </TextBox>
        <TextBox Height="55" HorizontalAlignment="Left" Margin="105,43,0,0" AcceptsReturn="True" TextWrapping="Wrap"
                 Text="{Binding Path=Description, Mode=TwoWay}"
                 Name="textBoxDescription" VerticalAlignment="Top" Width="191" />
        <ComboBox Height="23" HorizontalAlignment="Left" Margin="105,103,0,0" 
                  SelectedValue="{Binding Path=CategoryID, Mode=TwoWay}"
                  Name="comboBoxCategories" VerticalAlignment="Top" Width="191" />
        <TextBox Height="23" HorizontalAlignment="Left" Margin="105,133,0,0" 
                 Name="textBoxPrice" VerticalAlignment="Top" Width="191">
            <Binding Path="Price" StringFormat="c" UpdateSourceTrigger="LostFocus">
                <Binding.ValidationRules>
                    <local:ValidateProductPrice />
                </Binding.ValidationRules>
            </Binding>
        </TextBox>
        <Button Content="Edit" Height="23" HorizontalAlignment="Left" Margin="140,162,0,0" 
                Name="buttonEdit" VerticalAlignment="Top" Width="75" Click="buttonEdit_Click" />
        <Button Content="Cancel" Height="23" HorizontalAlignment="Left" Margin="221,162,0,0" 
                Name="buttonCancel" VerticalAlignment="Top" Width="75" Click="buttonCancel_Click" />
    </Grid>
</Window>
